<?php 

class skin_global {

//=====================================================================================================
//	REDIRECT
//=====================================================================================================

public function redirect( $url )
{
	global $CMS, $DB;

    $page = intval($CMS->input["page"]);

    if ( $page > 1 AND $CMS->is_error == 1)
	{
		$page = $page - 1;
	}

    $page = $page > 1 ? "&page={$page}" : "";
	
	if ( $_SESSION["url_return"] )
    {
    	$url_return = "&act=search_do{$_SESSION["url_return"]}";
        
        unset($_SESSION["url_return"]);
    }
	
	$CMS->class->session->save();
	
    header("location: {$url}{$page}{$url_return}");
    exit;
}

//===========================================================================
// Page transfer
//===========================================================================

public function page_transfer($msg,$page="index.php")
{
	global $CMS;

	$page_transfer = $page;

print <<<EOF
<html>
<head>
<title>{$CMS->vars['site_name']}</title>
<style type="text/css" media="all">
body
{
	background: #FFFFFF;
}

a
{
	color: black;
	text-decoration: none;
}

.page_transfer {
	width: 330px;
	margin-top: 100px;
	padding: 30px;
	background: #FFFFFF;

	text-align: center;
	color: #000000; 
	font-family: Verdana, Arial; 
	font-size: 11px;
}
</style>
<meta http-equiv="refresh" content="2; url={$page}">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<table width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="50%" align="center">
	<div class="page_transfer">

	{$msg}
	<br /><br /><img src="{$CMS->vars['img_url']}/icons/icon_loadingcircle.gif">
	<br /><br />(<a href="{$page}">{$CMS->lang['page_loading']}</a>)
	</div>
    </td>
  </tr>
</table>
</body>
</html>
EOF;
exit;
}

public function page_error_mini( $msg )
{
	global $CMS;
	
	$output = "";

$output .= <<<EOF
<div class="notice_error">
	{$msg}
</div>
EOF;

	return $output;
}

public function page_error($msg)
{
	global $CMS;
	
$output .= <<<EOF
<div class="block_top">
	Th&#244;ng b&#225;o
</div>
<div class="block_middle" style="padding: 20px; font-size: 14px;">
	<b>{$msg}</b>
</div>
<div class="block_bottom"></div>
<br />
<br />
EOF;

	return $output;
}


//===========================================================================
// SITE STATUS
//===========================================================================

public function site_status()
{
	global $CMS;
	
print <<<EOF
<html>
<head>
<title>{$CMS->vars['site_name']} -> {$CMS->vars['msg_subject']}</title>
<style type="text/css" media="all">
body
{
	background: #F2F2F2;	
}
.status {
	margin-top: 180px;
	padding: 5px;
	background: #FFFFFF;
	border: solid #808080 1px; 
	color: #000000; 
	font-family: Verdana, Arial; 
	font-size: 11px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<table border="0" cellpadding="0" cellspacing="5" width="500" align="center" class="status">
  <tr>
    <td width="100%">
	{$CMS->vars['msg_announce']}
    </td>
  </tr>
</table>
</body>
</html>
EOF;
}

//===========================================================================
// SECURITY
//===========================================================================

public function security( $type = 0 )
{
	global $CMS, $DB, $member;

if ( $CMS->vars['client_security'] == 1 )
{
	$output = "";

$output .= <<<EOF
<li><span>{$CMS->lang['security_code']}:</span><input class="input_text" Type="text" name="security_code" size="30" maxlength="32" emsg="{$CMS->lang['security_error']}"> &nbsp; <img style="margin-left: 5px;" class="security_captcha" src="{$CMS->vars['root_domain']}/?site=security&get=captcha&mod={$CMS->class->security->captcha_name}" align="absmiddle" alt="Security Code"></li>
EOF;

	return $output;
}

}

//===========================================================================
// BOARD NOTICE
//===========================================================================

public function board_notice()
{
	global $CMS;
	
	$output = "";
    
    if ( ! $CMS->vars['board_notice_alert'] )
    {
    	return false;
    }

$output .= <<<EOF
<div id="board_notice_alert" style="position: absolute; display: none; z-index: 999; margin-top: 100px; margin-left: 250px; border: solid #EEE 1px; border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px;">
<div style="width: 500px; padding: 10px; border: solid #808080 1px; background: #ffe9ae; color: #000; border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px;">
<p class="align_right"><a href="javascript:board_notice_close();"><img src="{$CMS->vars['img_url']}/icons/icon_close.png" /></a></p>
{$CMS->vars['board_notice_alert']}
</div>
</div>
<script language="javascript">
<!--
	function board_notice_close()
    {
    	my_setcookie("board_ntoice",1);
		document.getElementById("board_notice_alert").style.display = "none";
    }
    
    function board_notice_init()
    {
    	if ( my_getcookie("board_ntoice") )
        {
        	return false;
        }
        
        document.getElementById("board_notice_alert").style.display = "block";
    }
	board_notice_init();
//-->
</script>
EOF;

	return $output;
}

//===========================================================================
// DISPLAY ERROR
//===========================================================================

public function display_error()
{
	global $CMS;

 	// Error
    $CMS->errormsg = $_SESSION['msg'] ? $_SESSION['msg'] : $CMS->errormsg;
    $_SESSION['msg'] = "";
    unset($_SESSION['msg']);
    $output .= $CMS->errormsg ? $this->page_error_mini($CMS->errormsg) : "";   
    
    return $output;
}

//===========================================================================
// DISPLAY ERROR
//===========================================================================

public function onepay_logo()
{
	global $CMS;

 	$output = "";
    
$output .=<<<EOF
<p style="text-align:center; margin:10px"><img src="{$CMS->vars['img_url']}/logo/onepay.png" /></p>
EOF;
    
    return $output;
}

}

?>